﻿<Window x:Class="CurrencyTextBoxExample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:currency="clr-namespace:CurrencyTextBoxControl;assembly=CurrencyTextBoxControl"
        Title="CurrencyTextBox Example"
        Width="425"
        Height="228"
        >
    <Grid Name="LayoutRoot" Margin="5,6,5,4">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <currency:CurrencyTextBox Name="myCurrencyTextBox"
                                  Grid.Row="0"
                                  Grid.Column="1"
                                  Margin="10,40,5,0"
                                  VerticalAlignment="Top"
                                  VerticalContentAlignment="Center"
                                  FontFamily="Consolas"
                                  FontSize="24"
                                  Number="{Binding Number,
                                                   UpdateSourceTrigger=PropertyChanged,
                                                   ValidatesOnDataErrors=True}"
                                  StringFormat="C2"
                                  MaximumValue="220"
                                  MinimumValue="-1000">
            <currency:CurrencyTextBox.Style>
                <Style TargetType="currency:CurrencyTextBox">
                    <Style.Triggers>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="FrameworkElement.ToolTip" Value="{Binding RelativeSource={RelativeSource self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </currency:CurrencyTextBox.Style>
        </currency:CurrencyTextBox>
        <currency:CurrencyTextBox x:Name="myCurrencyTextBox_Copy"
        	Grid.Row="0"
        	Grid.Column="1"
        	Margin="10,79,5,0"
        	VerticalAlignment="Top"
        	VerticalContentAlignment="Center"
        	FontFamily="Consolas"
        	FontSize="24"
            StringFormat="C4"
        	Number="{Binding Number, UpdateSourceTrigger=PropertyChanged}" >

        </currency:CurrencyTextBox>
        <ListBox x:Name="listBox"/>
        <currency:CurrencyTextBox x:Name="currencyTextBox" Grid.Column="1" Margin="10,118,5,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="29" StringFormat="P" Number="23463"/>
        <Button x:Name="button" Content="SET MAX VALUE" Grid.Column="1" HorizontalAlignment="Left" Margin="90,10,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
        <Button x:Name="button1" Content="Button" Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="button1_Click"/>
    </Grid>
</Window>
